package _web;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

@WebServlet(urlPatterns = "/demo03",loadOnStartup = 1)
public class ServletDemo03 implements Servlet {
    private ServletConfig servletConfig;
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
    this.servletConfig=servletConfig;
        System.out.println("Servlet init....");
    }//默认情况下第一次Servlet被访问时调用。

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("hello service");
    }


    @Override
    public void destroy() {
        System.out.println("destory....");
    }
    //销毁时候调用 destory
}
